package com.kjlink.internal.workreport.other.controller;

import com.kjlink.internal.workreport.other.model.DayReportSummaryInfo;
import com.kjlink.internal.workreport.other.service.OtherService;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.time.LocalDate;

/**
 * 描述:
 * 一些其他的controller
 *
 * @author Vic.xu
 * @since 2024-05-21 9:42
 */
@RestController
@RequestMapping("/other")
public class OtherController {

    @Resource
    private OtherService otherService;

    /**
     * 填报率汇总
     */
    @RequestMapping("/day-report-summary")
    public ModelAndView unfilledReminder(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate date) {
        ModelAndView mv = new ModelAndView("other/day-report-summary");
        if (date == null) {
            date = LocalDate.now();
        }
        mv.addObject("date", date);
        DayReportSummaryInfo summary = otherService.dayReportSummaryInfo(date);
        mv.addObject("summary", summary);
        return mv;
    }
}
